package com.ailang.aiskand.model

import androidx.lifecycle.MutableLiveData
import com.ailang.aiskand.bean.AiChatBean
import com.ailang.aiskand.bean.Role
import com.hzjh.base.ext.frame.JHBaseVM

class MainModel : JHBaseVM() {
    val aiChatLiveData : MutableLiveData<ArrayList<AiChatBean>> = MutableLiveData(ArrayList())

    fun sendToAiMsg(msg: String){
        aiChatLiveData.value?.add(AiChatBean(msg,Role.user))
        aiChatLiveData.postValue(aiChatLiveData.value)
        sendMsg(msg){
            aiChatLiveData.value?.add(AiChatBean(it,Role.model))
            aiChatLiveData.postValue(aiChatLiveData.value)
        }
    }
}